<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>17-数组去重</title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = ['red','red','blue','orange','orange','black','white'];
			
			function unique(arr){
				//新的数组
				var newArr = [];
				//循环
				for(var i=0;i<arr.length;i++){
					if(newArr.indexOf(arr[i])==-1){
						newArr.push(arr[i]);
					}
				}
				return newArr;
			}
			
			var x = unique(arr);
			console.log("数组::"+x);//red,blue,orange,black,white
			
			
			
		</script>
	</body>
</html>
